package com.microservices.yucloud.appweb.config;

import com.microservices.yucloud.appweb.contants.StateMachineBuilderConstants;
import com.microservices.yucloud.appweb.enums.BizOrderEventsEnum;
import com.microservices.yucloud.appweb.enums.BizOrderStatusEnum;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.statemachine.StateMachine;

import javax.annotation.Resource;

/**
 * @author zy
 * @date 2019-09-03 16:29
 **/
@Configuration
public class BizOrderStatemachineConfig {

    @Resource
    private BizOrderStateMachineBuildFactory bizOrderStateMachineBuildFactory;

    @Bean("bizOrderStateMachine")
    public StateMachine<BizOrderStatusEnum, BizOrderEventsEnum> bizOrderStateMachine() {
        return bizOrderStateMachineBuildFactory.createStateMachine(StateMachineBuilderConstants.BIZ_ORDER_NAME);
    }
}
